﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Exceptionless;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;

namespace Api.Catalog.Swagger
{
    public static class SwaggerSetUp
    {

        public static void AddSwagger(this IServiceCollection services)
        {
            try
            {
                var apiName = "webApi";
                services.AddSwaggerGen(c =>
                {
                    c.SwaggerDoc("v1", new OpenApiInfo { 
                    Version="v1",
                    Title=$"{apiName} 接口文档 --- .net core 3.0.1 ",
                    Description =$"{apiName} Http Api V1"
                    });
                    c.OrderActionsBy(o => o.RelativePath);
                });
            }
            catch (Exception ex)
            {
                ex.ToExceptionless().ToString();
            }
           
        }

    }
}
